import BaseModel from "../../../cfw/mvc/BaseModel";
import ColumnItemModel from "./ColumnItemModel";
import ModelManager from "../../../cfw/mvc/ModelManager";
import ModuleManager from "../../../cfw/module/ModuleManager";
import XlsxData from "../../../cfw/xlsx/XlsxData";
import { ColumnItemModelEnum, ClotheItemModelEnum } from "../../../public/GameEnumConfig";
import ClotheManager from "./ClotheManager";
import ClotheItemModel from "./ClotheItemModel";
import DecorationMgrInterface from "../../../public/interface/DecorationMgrInterface";



export default class DressingRoomManager extends BaseModel implements DecorationMgrInterface{

    protected suitcaseID: number = 1;
    protected columnMgr: ModelManager<ColumnItemModel> = new ModelManager();
    protected columnList: ColumnItemModel[] = []
    constructor(suitID: number) {
        super();
        this.suitcaseID = suitID;
        this.columnMgr.initWithData(ModuleManager.dataManager.get(ColumnItemModel.CLASS_NAME), ColumnItemModel)
        let columnData: XlsxData = this.columnMgr.getData()

        if (columnData) {
            let columList = columnData.getIndexByID(ColumnItemModelEnum.box, this.suitcaseID)
            // cc.log('columList ', columList)
            for (let index = 0; index < columList.length; index++) {
                const element = columList[index];
                let columnItem: ColumnItemModel = this.columnMgr.getByID(element)
                this.columnList.push(columnItem)

            }
        }
    }

    getColumnList() {
        return this.columnList;
    }

    getContentList(columnID) {
        let list = []
        let clothData: XlsxData = ClotheManager.instance().getClotheData();
        let clotheIDLsit = clothData.getIndexByID(ClotheItemModelEnum.columnID, columnID)
        // cc.log('clotheIDLsit ', clotheIDLsit)
        for (let index = 0; index < clotheIDLsit.length; index++) {
            const element = clotheIDLsit[index];
            let clotheItem: ClotheItemModel = ClotheManager.instance().getClothe(element)
            list.push(clotheItem)
        }
        return list;
    }

}
